<?php
/**
 * Created by PhpStorm.
 * User: JYuans
 * Date: 2019/12/19
 * Time: 20:56
 */
namespace Mhome\Controller;

class UserController extends MhomeController {

    public function editPasswordAction(){
        $password = $_REQUEST["password"]?md5($_REQUEST["password"]):$this->errorReturn("请输入密码");

        $update_result = M("User")
            ->where(['user_id'=>$this->user_data['user_id']])
            ->setField("password",$password);
        if($update_result){
            $this->successReturn("重置成功");
        }else{
            $this->errorReturn("新密码不能与原密码相同");
        }
    }
}